package com.rico.kok.service;

import com.rico.kok.entity.CommentLike;
import com.rico.kok.mapper.CommentLikeMapper;
import com.rico.kok.service.interf.CommentLikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author：Rico_Skipper(JinYang Han)
 * @Date：2022/5/3 21:51
 */
@Service
public class CommentLikeServiceImpl implements CommentLikeService {

    @Autowired
    CommentLikeMapper commentLikeMapper;

    @Override
    public int commentLike(CommentLike commentLike) {
        return commentLikeMapper.commentLike(commentLike);
    }

    @Override
    public int commentNoLike(CommentLike commentLike) {
        return commentLikeMapper.commentNoLike(commentLike);
    }

    @Override
    public List<CommentLike> selectCommentLikes(CommentLike commentLike) {
        return commentLikeMapper.selectCommentLikes(commentLike);
    }

    @Override
    public int isCommentLike(CommentLike commentLike) {
        List<CommentLike> commentLikes = commentLikeMapper.selectCommentLikes(commentLike);
        if (commentLikes.size()==0){
            return 0;
        }else{
            return 1;
        }
    }
}
